package com.hecn.log;

import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;

/**
 * 方法执行成功后返回通知
 *
 * @author 24497
 */
public class AfterLog implements AfterReturningAdvice {
  /**
   *
   * @param returnValue 执行方法后返回的值（如果有）
   * @param method 被调用的方法
   * @param args 参数
   * @param target target of the method invocation. May be {@code null}.
   * @throws Throwable if this object wishes to abort the call. Any exception thrown will be
   *     returned to the caller if it's allowed by the method signature. Otherwise the exception
   *     will be wrapped as a runtime exception.
   */
  public void afterReturning(Object returnValue, Method method, Object[] args, Object target)
      throws Throwable {
    System.out.println("执行了" + method.getName() + "方法,返回结果为" + returnValue);
  }
}
